// See https://sequelize.org/master/manual/model-basics.html
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;

module.exports = function (app) {
  const sequelizeClient = app.get('sequelizeClient');
  const viplevel = sequelizeClient.define('viplevel', {
    // 等级
    level: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 等级名称
    levelName: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 升级方式
    Upmethod: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 升级条件值
    Upvalue: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 有效天数
    effectiveDate: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 支付折扣
    Paydiscount: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 积分加速
    integralUp: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 状态
    state: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 操作
    // operate: {
    //   type: DataTypes.STRING,
    //   allowNull: false,
    // },
  }, {
    hooks: {
      beforeCount(options) {
        options.raw = true;
      }
    }
  });

  // eslint-disable-next-line no-unused-vars
  viplevel.associate = function (models) {
    // Define associations here
    // See https://sequelize.org/master/manual/assocs.html
  };

  return viplevel;
};

